package com.stock.demo.function.selfselect.presenter;

import com.stock.demo.function.selfselect.view.SelfSelectView;
import com.stock.demo.model.StockBean;

import java.util.ArrayList;
import java.util.Random;

/**
 * Created by XuZhaoyu on 2017/6/29.
 */

public class SelfSelectPresenterImpl implements SelfSelectPresenter {

    private SelfSelectView mSelfSelectView;

    public SelfSelectPresenterImpl(SelfSelectView selfSelectView) {
        mSelfSelectView = selfSelectView;
    }

    @Override
    public void getStockInfo() {
        ArrayList<StockBean> selectBeen = new ArrayList<>();
        Random random = new Random();
        for (int i = 0; i < 50; i++) {
            StockBean bean = new StockBean();
            bean.mSymbol = "601800";
            bean.mName = "中国交建";
            bean.mLastTrade = 16.45;
            bean.mChangePercent = "10.03%";
            bean.mChange = random.nextDouble() * 6 - 3;
            bean.mBid = 22.45;
            bean.mAsk = 22.45;
            bean.mPreClose = 22.45;
            bean.mOpen = 22.45;
            bean.mVolume = 10000;
            bean.mTurOver = 224500;
            selectBeen.add(bean);
        }
        mSelfSelectView.onGetStockInfo(selectBeen);
    }

}
